import qs from "qs";
import instance from "@/request/request";
// /order/list 查询订单
export const getOrderListApi = (
  params: any
): RES<ISearchOrderList<OrderList>> => instance.get("/order/list", { params });

// /order/delete 批量删除订单
export const deleteOrderListApi = (ids: any): RES<Object> =>
  instance.post(`/order/delete?ids=${ids.join(",")}`);

//   查询订单详情接口 /order/{id}
export const searchOrderListApi = (id: any): NRES<INSearchOrderList> =>
  instance.get(`/order/${id}`);
// ISearchOrderList返回值类型

// /order/update/close 批量关闭订单
export const closeOrderListApi = (ids: any, note: any): RES<Object> =>
  instance.post(`/order/update/close?ids=${ids.join(",")}&note=${note}`);

// 获取订单设置接口 /orderSetting/{id}
export const getOrderSetApi = (id: number): NRES<IOrderSet> =>
  instance.get(`/orderSetting/${id}`);
// 修改订单设置接口 /orderSetting/update/{id}
export const updateOrderSetApi = (
  id: number,
  params: IOrderSet
): NRES<IOrderSet> => instance.post(`/orderSetting/update/${id}`, params);
// 分页查询退货申请 /returnApply/list
export const orderSalesApi = (params: any): RES<IOrdersales<orderSales>> =>
  instance.get(`/returnApply/list`, { params });
// /returnApply/delete 批量删除退货申请
export const deleteOrderSalesListApi = (ids: any): RES<Object> =>
  instance.post(`/returnApply/delete?ids=${ids.join(",")}`);

// 获取退货申请详情 /returnApply/{id}
export const orderSalesDetailsApi = (id: number): NRES<IOrderSalesList> =>
  instance.get(`/returnApply/${id}`);

// /returnReason/list 分页查询全部退货原因
export const orderSalesReasonsApi = (
  params: any
): RES<IOrderReason<orderReasonList>> =>
  instance.get(`/returnReason/list`, { params });

//  /returnReason/update/status 修改退货原因启用状态
export const updateOrderSalesListApi = (ids: any, params: any): RES<Object> =>
  instance.post(
    `/returnReason/update/status?ids=${ids.join(",")}&status=${params}`
  );

// /returnReason/delete 批量删除退货原因
export const deleteOrderSalesReasonApi = (ids: any): RES<Object> =>
  instance.post(`/returnReason/delete?ids=${ids.join(",")}`);

// /returnReason/{id} 编辑退货获取数据
export const editOrderSalesListApi = (id: number): RES<IEditOrder> =>
  instance.get(`/returnReason/${id}`);

//  /returnReason/create 添加退货原因
export const addOrderSalesListApi = (params: any): RES<IEditOrder> =>
  instance.post(`/returnReason/create`, params);

// //returnReason/update/{id} 修改退货原因
export const updateEditOrderSalesListApi = (
  id: number,
  params: any
): RES<IEditOrder> => instance.post(`/returnReason/update/${id}`, params);
